If you are writing scripts using a real external device, such as an Android, you can simulate key events using the SendText(Text) command.
The following keys can be used with the "SendText" command:
For deleting text: {BKSP}
For submitting a text field: {ENTER}
For waking a device (if it is in sleep mode, if the screen is black): {WAKE}
For unlocking the device if it is actually locked: {UNLOCK}
For Browser Back button : {WEBBACK}
Toggle orientation:
For landscape: {LANDSCAPE}.
For Portrait: {PORTRAIT}.
For opening the menu: {F2}
For changing windows ( as in nexus devices - the right button next to home button in the screen ) - {recent_apps}
Click on Home: {Home}
Click on Back: {ESC}
Click on Power key: {POWER}
For pasting text: {PASTE}
For Android version 4.3 and above:
To open Notification Bar: {NOTIFICATION}
To open Settings: {SETTINGS}